<template>
  <div>
    <el-container>
      <el-header>Header</el-header> 
      <el-container>
        <el-aside width="200px" style="background-color: rgb(238, 241, 246)">
          <el-menu :default-openeds="['1', '2','3']" :router="true">
            <el-submenu v-for=" menu in menus" :key="menu.mid" :index="menu.mid+''">
              <template slot="title"><i class="el-icon-message"></i>{{menu.mname}}</template>
              <el-menu-item-group>
                <el-menu-item v-for="submenu in menu.children" :index="submenu.path+''" :key="submenu.mid">
                  {{submenu.mname}}
                </el-menu-item>
              </el-menu-item-group>
            </el-submenu>
            <!-- 查询动态展示菜单 -->
            <!-- <el-submenu index="1">
              <template slot="title"
                ><i class="el-icon-message"></i>学生管理</template
              >
              <el-menu-item-group>
                <el-menu-item index="1-1">
                  <router-link to="/studentList">学生列表</router-link>
                </el-menu-item>
                <el-menu-item index="/studentList">学生列表</el-menu-item>
                <el-menu-item index="1-2">选项2-1</el-menu-item>
              </el-menu-item-group>
            </el-submenu>
            <el-submenu index="2">
              <template slot="title"
                ><i class="el-icon-message"></i>员工管理</template
              >
              <el-menu-item-group>
                <el-menu-item index="/employeeList">员工列表</el-menu-item>
                <el-menu-item index="/employeeAdd">员工添加</el-menu-item>
              </el-menu-item-group>
            </el-submenu>
            <el-submenu index="3">
              <template slot="title"
                ><i class="el-icon-message"></i>权限管理</template
              >
              <el-menu-item-group>
                <el-menu-item index="/menuList">菜单管理</el-menu-item>
                <el-menu-item index="/roleList">角色管理</el-menu-item>
              </el-menu-item-group>
            </el-submenu> -->
          </el-menu>
        </el-aside>
        <el-main>
          <router-view />
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script>
export default {
  data() {
    return {
      menus: []
    };
  },
  created() {
    this.getMenus();
  },
  methods: {
    getMenus() {
      //前端访问后端，必须在请求头中携带token
      this.$axios.get("http://localhost:8080/menu/getmuens").then((resp) => {
        if(resp.data.code==200){
          this.menus=resp.data.data;
        }
      });
    },
  },
};
</script>

<style>
/* .el-header,
.el-footer {
  background-color: #b3c0d1;
  color: #333;
  text-align: center;
  line-height: 60px;
}

.el-aside {
  background-color: #d3dce6;
  color: #333;
  text-align: center;
  line-height: 200px;
}

.el-main {
  background-color: #e9eef3;
  color: #333;
  text-align: center;
  line-height: 160px;
}

body > .el-container {
  margin-bottom: 40px;
}

.el-container:nth-child(5) .el-aside,
.el-container:nth-child(6) .el-aside {
  line-height: 260px;
}

.el-container:nth-child(7) .el-aside {
  line-height: 320px;
} */
</style>